#pragma once

#define BLOCK_TYPE_CUBE 0
//#define BLOCK_TYPE_ 1
#define BLOCK_TYPE_GRASS 2
#define BLOCK_TYPE_LEAVES 3
#define BLOCK_TYPE_TORCH 4
#define BLOCK_TYPE_DOUBLE_SLAB 5
#define BLOCK_TYPE_STAIRS 6
#define BLOCK_TYPE_SLAB 7
#define BLOCK_TYPE_RAIL 8
#define BLOCK_TYPE_CROPS 9
#define BLOCK_TYPE_LADDER 10
#define BLOCK_TYPE_WATER 16

class Client;

class Material {
public:
	static void _materials_init(Client* client);
	Material();
	Material(const Material& m);
	Material(const Material* m);
	~Material();
	unsigned char getId();
	void setId(unsigned char _id);
	unsigned char getData();
	void setData(unsigned char _data);
	bool isSolid();
	int isBiomeColored();
	void setBiomeColored(int c);
	bool isClickable();
	void setClickable(bool c);
	bool isCollidable();
	void setCollidable(bool c);

	struct renderProps {
		u8 blockType;
		float u;
		float v;
		float w;
		float h;
		float specular;
		int animations;
	} renderProps;

	static Material* FindByName(const char* _name);
	static Material* FindById(const unsigned char _id);
	static Material* FindByIdData(const unsigned char _id, const unsigned char _data);
	static Material* GetAll();
	static u32 GetBlockColor(u8 id, u8 data);

/*
	static Material* AIR; // 0
	static Material* STONE; // 1
	static Material* GRASS; // 2
	static Material* DIRT; // 3
	static Material* COBBLESTONE; // 4
	static Material* WOODEN_PLANKS; // 5
	static Material* SAPLINGS; // 6
	static Material* BEDROCK; // 7
	static Material* WATER; // 8-9
	static Material* LAVA; // 10-11
	static Material* SAND; // 12
	static Material* GRAVEL; // 13
	static Material* GOLD_ORE; // 14
	static Material* IRON_ORE; // 15
	static Material* COAL_ORE; // 16
	static Material* WOOD; // 17
	static Material* LEAVES; // 18
	static Material* SPONGE; // 19
	static Material* GLASS; // 20
*/

private:
	unsigned char id;
	unsigned char data;
	bool solid;
	bool collidable;
	bool clickable;
	int biomeColored;
	char* name;
};
